﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Entities.Admin;
using Entities.PBKT;
using BLL.PBKT;

namespace WindowsForms.PBKT
{
	public partial class FormDoiTuyenTKCauThu : Form
	{
		public FormDoiTuyenTKCauThu()
		{
			InitializeComponent();
		}
		private GiaiDau selectGd = null;
		private void btnThongKe_Click(object sender, EventArgs e)
		{
			if (selectGd != null)
			{
				List<CauThu> dsCauThu = PlayerFootball.All(selectGd);
				dgvThongKe.DataSource = dsCauThu.OrderByDescending(c=>c.SoBanThang).Skip(0).Take(5).ToList();
			}
			else
				MessageBox.Show("Chưa chọn giải đấu");
		}

		private void FormDoiTuyenTKCauThu_Load(object sender, EventArgs e)
		{
			dgvThongKe.AutoGenerateColumns = false;
			cbbGiaiDau.DataSource = GiaiDau.Objects.All().ToList();
			cbbGiaiDau.DisplayMember = "TenGiaiDau";
			cbbGiaiDau.ValueMember = "MaGiaiDau";
			
		}

		private void cbbGiaiDau_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (cbbGiaiDau.SelectedIndex >= 0)
			{
				selectGd = cbbGiaiDau.SelectedItem as GiaiDau;
			}
		}
	}
}
